package com.silence.tool.tool;

import lombok.extern.slf4j.Slf4j;
import org.apache.pdfbox.Loader;
import org.apache.pdfbox.multipdf.Splitter;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.junit.jupiter.api.Test;

import java.io.File;
import java.io.IOException;
import java.util.List;

/**
 * @Author silence
 * @Email meng.wl@neusoft.com
 * @Date 2025-01-20 09:41
 * @Description
 */
@Slf4j
public class JunitTest01 {

    @Test
    void test01() {

        String sourcePath = "F:\\Download\\FeiShu\\TestFile\\2020智源大会文集合集.pdf";
        String targetDir = "F:\\Download\\FeiShu\\TestFile\\output01";

        try {
            PdfSplitUtil.splitToPages(sourcePath, targetDir);
        } catch (IOException e) {
            log.error("拆分失败", e);
        }

        log.info("拆分完成");
    }

    @Test
    void test02() {
        String sourcePath = "F:\\Download\\FeiShu\\TestFile\\2020智源大会文集合集.pdf";
        String targetPath = "F:\\Download\\FeiShu\\TestFile\\output02\\2020智源大会文集合集_split.pdf";

        try {
            PdfSplitUtil.splitByRange(sourcePath, targetPath, 10, 20);
        } catch (IOException e) {
            log.error("拆分失败", e);
        }

        log.info("拆分完成");
    }
    
    @Test
    void test03() {
        
    }

}
